<?php
include("../functions.php");
include("../libs/smarty.class.php");

$smarty = new Smarty();
$title = "Edycja praktyki";
$smarty->assign("title",$title);

$edit_id = $_GET['edit_id'];

if(isset($_POST['update'])){
    $edit_id = $_POST['practice_id'];
    foreach($_POST as $key => $value){
        $data[$key] = $value;
    }
    echo updatePractice($data);
    $info_action = getInfo(17);
    $info_color = "green";
}

$technologies = array();
$technologies = getRows("*","technologies");


if($edit_id != ''){
    $practiceDetails = getPracticeDetails($edit_id);
    $smarty->assign("p",$practiceDetails['practice']);
    $smarty->assign("c",$practiceDetails['company']);
    $smarty->assign("pe",$practiceDetails['person']);
    $smarty->assign("practiceDetails",$practiceDetails);
}
$smarty->assign("info_action",$info_action);
$smarty->assign("info_color",$info_color);
$smarty->assign("technologies",$technologies);
$smarty->display('edit_practice.tpl');
?>
